home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 14 / CU Amiga Magazine's Super CD-ROM 14 (1997)(EMAP Images)(GB)(Track 1 of 3)[!][issue 1997-09].iso / CUCD / Programming / IEditor / Generators / C / fonts.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-06-17  |  2.3 KB  |  91 lines

  1. /// Includes
  2. #define INTUI_V36_NAMES_ONLY
  3.  
  4. #include <exec/types.h>                 // exec
  5. #include <exec/lists.h>
  6. #include <exec/nodes.h>
  7. #include <dos/dos.h>                    // dos
  8. #include <clib/exec_protos.h>           // protos
  9. #include <clib/dos_protos.h>
  10. #include <pragmas/exec_pragmas.h>       // pragmas
  11. #include <pragmas/dos_pragmas.h>
  12.  
  13. #include <string.h>
  14. #include <stdio.h>
  15. #include <stdlib.h>
  16. #include <ctype.h>
  17.  
  18. #include "DEV_IE:Generators/defs.h"
  19. #include "DEV_IE:Include/IEditor.h"
  20. #include "DEV_IE:Generators/C/Protos.h"
  21. ///
  22.  
  23.  
  24. /// WriteFontPtrs
  25. void WriteFontPtrs( struct GenFiles *Files, struct IE_Data *IE )
  26. {
  27.     struct TxtAttrNode *fnt;
  28.  
  29.     if( IE->SrcFlags & OPENDISKFONT ) {
  30.     for( fnt = IE->FntLst.mlh_Head; fnt->txa_Next; fnt = fnt->txa_Next ) {
  31.         if( fnt->txa_Flags & FPB_DISKFONT ) {
  32.         FPrintf( Files->Std,  "struct TextFont\t\t*%sFont = NULL;\n", fnt->txa_Label );
  33.         FPrintf( Files->XDef, "extern struct TextFont\t\t*%sFont;\n", fnt->txa_Label );
  34.         }
  35.     }
  36.     }
  37. }
  38. ///
  39. /// WriteOpenFonts
  40. void WriteOpenFonts( struct GenFiles *Files, struct IE_Data *IE )
  41. {
  42.     struct TxtAttrNode *fnt;
  43.     BOOL                ok = FALSE;
  44.  
  45.     if( IE->SrcFlags & OPENDISKFONT ) {
  46.  
  47.     for( fnt = IE->FntLst.mlh_Head; fnt->txa_Next; fnt = fnt->txa_Next ) {
  48.         if( fnt->txa_Flags & FPB_DISKFONT )
  49.         ok = TRUE;
  50.     }
  51.  
  52.     if( ok ) {
  53.  
  54.         FPuts( Files->XDef, "extern struct Library\t*DiskfontBase;\n"
  55.                 "extern struct Library\t*GfxBase;\n"
  56.                 "extern BOOL OpenDiskFonts( void );\n"
  57.                 "extern void CloseDiskFonts( void );\n" );
  58.  
  59.         FPuts( Files->Std,  "\nBOOL OpenDiskFonts( void )\n"
  60.                 "{\n" );
  61.  
  62.         for( fnt = IE->FntLst.mlh_Head; fnt->txa_Next; fnt = fnt->txa_Next ) {
  63.         if( fnt->txa_Flags & FPB_DISKFONT )
  64.             FPrintf( Files->Std, "\tif (!( %sFont = OpenDiskFont( &%s )))\n"
  65.                      "\t\treturn( FALSE );\n",
  66.                  fnt->txa_Label, fnt->txa_Label );
  67.         }
  68.  
  69.         FPuts( Files->Std, "\treturn( TRUE );\n"
  70.                    "}\n\n"
  71.                    "void CloseDiskFonts( void )\n"
  72.                    "{\n" );
  73.  
  74.         for( fnt = IE->FntLst.mlh_Head; fnt->txa_Next; fnt = fnt->txa_Next ) {
  75.         if( fnt->txa_Flags & FPB_DISKFONT ) {
  76.             FPrintf( Files->Std, "\tif ( %sFont ) {\n"
  77.                      "\t\tCloseFont( %sFont );\n"
  78.                      "\t\t%sFont = NULL;\n"
  79.                      "\t}\n",
  80.                  fnt->txa_Label, fnt->txa_Label, fnt->txa_Label );
  81.         }
  82.         }
  83.  
  84.         FPuts( Files->Std, "}\n" );
  85.     }
  86.  
  87.     }
  88. }
  89. ///
  90.  
  91.